package org.mikrosopht.client;

import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Widget;


public class MovieListPruner extends Composite implements ClickListener {
  private CheckBox screenings = new CheckBox("Show only my screenings");
  private MovieListPrunerEventReceiver receiver;

  public MovieListPruner(MovieListPrunerEventReceiver receiver) {
    this.receiver = receiver;
    screenings.addClickListener(this);
    initWidget(screenings);
  }

  public void onClick(Widget sender) {
    if (sender == screenings) {
      receiver.onScreeningsClick(screenings.isChecked());
    }
  }

  public void setScreeningsChecked(boolean value) {
    screenings.setValue(value);
  }
}
